const config = require('./config')
export const upload = (filePath,data={}) => {
	return new Promise((res, rej) => {
		uni.uploadFile({
			url: config.url + 'uploadImage',
			filePath,
			header: {
				"token": uni.getStorageSync('token')
			},
			name:'file',
			formData: data,
			success: (uploadFileRes) => {
				console.log(uploadFileRes, '上传成功')
				res(uploadFileRes)
			},
			fail: (res) => {
				console.log(res, '上传失败')
				rej(res)
			}
		})
	})
}